package sk.stuba.fiit.pki.service;

import java.io.IOException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.SignatureException;
import java.security.UnrecoverableEntryException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CRLException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateParsingException;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;
import java.util.Collection;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import sk.stuba.fiit.pki.entity.CRLEntity;
import sk.stuba.fiit.pki.ws.schema.beans.CrlRequest;
import sk.stuba.fiit.pki.ws.schema.beans.CrlResponse;

public interface CrlService {

	public List<CRLEntity> findCrl() throws DataAccessException;

	public void save(CRLEntity crlEntity);
	
	public void delete(CRLEntity crlEntity);

	public  byte[] generateCRL(BigInteger crlSerialNum,
			List<BigInteger> certSerialNum, X509CRL crl)
			throws InvalidKeyException, KeyStoreException,
			NoSuchAlgorithmException, CertificateException,
			UnrecoverableEntryException, CRLException, NoSuchProviderException,
			SecurityException, SignatureException, IOException;

	public  byte[] getActualCRL(CrlRequest request, BigInteger crlSerialNum, List<BigInteger> revocateCert) throws CRLException, InvalidKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, UnrecoverableEntryException, NoSuchProviderException, SecurityException, SignatureException, IOException;

	public  byte[] generateFirstCRL(BigInteger crlSerialNum,
			List<BigInteger> certSerialNum) throws CertificateParsingException,
			InvalidKeyException, CRLException, NoSuchProviderException,
			SecurityException, SignatureException, IOException,
			UnrecoverableKeyException, KeyStoreException,
			NoSuchAlgorithmException, CertificateException,
			UnrecoverableEntryException;

	public void deleteAllCertificates();
}
